package com.only4play.codegen.processor.vo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.only4play.codegen.support.annotation.FieldDesc;
import com.only4play.codegen.support.model.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author mdy
 * * @date 2024/9/16
 */
@Data
public class AbstractBaseEntityVo {

    @Schema(
            title = "数据版本"
    )
    private int version;
    @Schema(
            title = "主键"
    )
    private Long id;


    @TableField(value = "create_time",fill = FieldFill.INSERT)
    @FieldDesc(name = "创建时间")
    private Date createTime;

    @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
    @FieldDesc(name = "更新时间")
    private Date updateTime;

    @TableField(value = "create_user_id",fill = FieldFill.INSERT)
    @FieldDesc(name = "创建人")
    private Long createUserId;

    @TableField(value = "update_user_id",fill = FieldFill.INSERT_UPDATE)
    @FieldDesc(name = "更新人")
    private Long updateUserId;

    protected AbstractBaseEntityVo(BaseEntity source) {
        this.setVersion(source.getVersion());
        this.setId(source.getId());
        this.setCreateTime(source.getCreateTime());
        this.setUpdateTime(source.getUpdateTime());
        this.setCreateUserId(source.getCreateUserId());
        this.setUpdateUserId(source.getUpdateUserId());
    }
    protected AbstractBaseEntityVo() {
    }
}
